package com.yowasa.xiuxian.engine.battle.enemy.strategy;

import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.constant.XiuxianConstants;
import com.yowasa.xiuxian.engine.battle.strategy.BaseDefendStrategy;
import com.yowasa.xiuxian.engine.battle.strategy.BattleStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.entity.enums.StageEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@BS(name = "红莲冰茧")
@Order(3)
@Component
public class HongLianZhiJian extends BaseDefendStrategy {



    @Override
    public ElementEnum getElement() {
        return ElementEnum.GOLD;
    }

    @Override
    public void limit(UserBO user) {
        throw new HandlerException("无法学习");
    }

    @Override
    public String limitDesc() {
        return "无法学习妖兽技能";
    }

    @Override
    public String desc() {
        return "至多承受5%自己最大生命值的伤害";
    }

    @Override
    public int defend(UserBattleContent user, UserBattleContent battleUser, BattleStrategy bs, int dmg, BattleContent content) {
        int maxDmg = (int) (user.getBattleInfo().getHp() * 0.05);
        if (dmg > maxDmg) {
            return maxDmg;
        }
        return dmg;
    }


    @Override
    public boolean check(UserBattleContent user, BattleStrategy bs, BattleContent content) {
        return true;
    }


}
